import os
'''
生成list.txt来表示图片路径与标签的关系。
'''
class_names_to_ids = {'normal': 0, 'porn': 1, 'sexy': 2}
data_dir = 'E:/working/balan-porn'
output_path = 'list.txt'
# with open(output_path, 'w') as f:
#     for class_name in class_names_to_ids.keys():
#         images_list = os.listdir(data_dir + os.sep + class_name)
#         for image_name in images_list:
#             f.write('{}/{} {}\n'.format(class_name, image_name, class_names_to_ids[class_name]))



labling_dict = {}
for class_name in class_names_to_ids.keys():
    images_list = os.listdir(data_dir + os.sep + class_name)

    for image_name in images_list:
        img_path = data_dir+'/'+class_name+'/'+image_name
        labling_dict[img_path] =  class_names_to_ids[class_name]



